package game.leon.engine.script.exec;

import java.util.ArrayList;
import java.util.List;

/**
 * A frame contenxt
 * 局部变量都在frame里面, frame是一个链, 逐个遍历, 就能做GC了
 * lexical scope!!
 * User: BianP
 * Date: 12-2-3
 */
class Frame {
    private List<Var> stack = new ArrayList<Var>();
    private int arguments = 0;
    // called by caller
    public int argument(Var var) {
        stack.add(var);
        return stack.size();
    }
    // called by callee
    public int local(Var var) {
        stack.add(var);
        return stack.size();
    }
    public Var get(int id) {
        return stack.get(id);
    }
}
